<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>Title</title>
		<style type="text/css">
			.table{
				position: absolute;
				top: 300px;
				width: 200px;
				height: 400px;
				border: #00ffff solid 1px;
				background: #aaff7f;
				left:200px;
				
			}
		</style>
	</head>
	<body>
		<span id="txt">欢迎欢迎</span>
		<ul id="city">

		</ul>

		<table class="table" border="1" cellspacing="" cellpadding="">
			<thead>
				<tr>
					<th>id</th>
					<th>姓名</th>
					<th>年龄</th>
				</tr>
			</thead>
			<tbody id="body">

			</tbody>


		</table>
		<span id="">
			<input type="text" name="" id="input" placeholder="请输入用户信息" />
		</span>
		<span id="">
			<input type="button" name="" id="" value="确定" onclick="getInfo()"/>
		</span>
		
		
		<input type="button" name="" id="" value="增加信息" onclick="addinfo()"/>
		<ul id="ul" >
			
		</ul>
		<script type="text/javascript">
			var city = [1, 2, 3, 4, 5]
			var user = [{
				id: "01",
				name: '两此',
				age: 18
			}, {
				id: "01",
				name: '两此',
				age: 18
			}, {
				id: "01",
				name: '两此',
				age: 18
			}, {
				id: "01",
				name: '两此',
				age: 18
			}]
			for(var i in user)
			{
				var tr=document.createElement('tr');
				for(var key in user[i]){
					var td=document.createElement('td');
					td.innerText=user[i][key];
					tr.appendChild(td);
				}
				var parentTag=document.getElementById('body');
				parentTag.appendChild(tr)
			}
			for (var i in city) {
				var text = city[i];
				var tag = document.createElement('li');
				tag.innerText = text;
				var parentTag = document.getElementById('city');
				parentTag.appendChild(tag)
			}

			function addinfo() {
				//console.log('你好啊')
				var parent=document.getElementById('ul')
				var li=document.createElement('li');
				li.innerText='我擦';
				parent.appendChild(li);
				console.log('yes');
				
			}
			function getInfo(){
				var input=document.getElementById('input');
				var info=input.value;
				if(info==''){
					alert('输入不能为空！')
					return;
				} 
				console.log(info);
				input.value='';
			}
			//setInterval(show,1000);
			//       var tag=document.getElementById('txt');
			// var text=tag.innerText;
			// console.log(text)
			// tag.innerText='我是你大爹'
		</script>
	</body>
</html>
